home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / cat3 / open.3 < prev    next >
Encoding:
Text File  |  1993-03-03  |  2.5 KB  |  67 lines

  1.  
  2.  
  3.  
  4. OPEN(3)             MINTLIB LIBRARY FUNCTIONS             OPEN(3)
  5.  
  6.  
  7. N✓NA✓AM✓ME✓E
  8.        open - open or create a file for reading or writing
  9.  
  10. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  11.        #include <unistd.h>
  12.        #include <fcntl.h>
  13.  
  14.        int open(const char *filename, int flags, ...);
  15.  
  16. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  17.        filename  points to the pathname of a file. open opens the
  18.        named file for reading and/or writing, as specified by the
  19.        flags  argument,  and  returns a descriptor for that file.
  20.        The flags argument may indicate the file is to be  created
  21.        if  it  does  not already exist (by specifying the O_CREAT
  22.        flag).  In this case an extra integer parameter  pmode  is
  23.        used;  the file is created with mode pmode as described in
  24.        chmod and  modified  by  the  process'  umask  value  (see
  25.        umask).
  26.  
  27.        flags  values are constructed by ORing flags from the fol-
  28.        lowing list (one and only one of  the  first  three  flags
  29.        below must be used):
  30.          - O_RDONLY  Open for reading only.
  31.          - O_WRONLY  Open for writing only.
  32.          - O_RDWR    Open for reading and writing.
  33.  
  34.          - O_NDELAY  Non-blocking I/O.
  35.          -  O_SYNC    Synchronize after writes (not implemented).
  36.          - O_APPEND  If set, the seek pointer will be set to
  37.                      the end of the file prior to each write.
  38.          - O_CREAT   Create the file if it doesn't exist already.
  39.          - O_TRUNC   If the file exists and is a regular file,
  40.                      and the file is successfully opened using
  41.                      O_RDWR or O_WRONLY, its length is truncated
  42.                      to zero.
  43.          - O_EXCL    If O_EXCL and O_CREAT are set, open will
  44.                      fail if the file exists.
  45.  
  46.        The seek pointer used to mark the  current position within
  47.        the file is set to the beginning of the file.
  48.  
  49.        The new descriptor is set to  remain  open  across  execve
  50.        system calls; see close and fcntl.
  51.  
  52. R✓RE✓ET✓TU✓UR✓RN✓N V✓VA✓AL✓LU✓UE✓ES✓S
  53.        open  returns  a  non-negative file descriptor on success.
  54.        On failure, it returns -1 and sets errno to  indicate  the
  55.        error.
  56.  
  57. S✓SE✓EE✓E A✓AL✓LS✓SO✓O
  58.        c✓ch✓hm✓mo✓od✓d(✓(3✓3)✓),✓,  c✓cl✓lo✓os✓se✓e(✓(3✓3)✓),✓, c✓cr✓re✓ea✓at✓t(✓(3✓3)✓),✓, d✓du✓up✓p(✓(3✓3)✓),✓, f✓fc✓cn✓nt✓tl✓l(✓(3✓3)✓),✓, l✓ls✓se✓ee✓ek✓k(✓(3✓3)✓),✓,
  59.        r✓re✓ea✓ad✓d(✓(3✓3)✓),✓, u✓um✓ma✓as✓sk✓k(✓(3✓3)✓),✓, w✓wr✓ri✓it✓te✓e(✓(3✓3)✓)
  60.  
  61.  
  62.  
  63.  
  64. MiNT docs 0.1              3 March 1993                         1
  65.  
  66.  
  67.